from openpyxl import load_workbook


class Excel_Data_Delete:
    """
        读取删除用户成功的数据
    """
    @staticmethod
    def read_delete_success():
        wb = load_workbook(
            r"/WebAppTest/WebTest/WebAutomationEncapsulation/CaseFiles/deleteuser_demo.xlsx")
        st = wb["删除用户成功"]                                 # 4列登陆用的账户，密码，要删除的用户名，和result
        data = [[st.cell(row=i, column=j).value for j in range(1,5)] for i in range(2, st.max_row + 1)]
        return data

    """
        读取删除用户失败的数据，删除失败一般是因为数据不存在
    """
    @staticmethod
    def read_delete_fail():
        wb = load_workbook(
            r"/WebAppTest/WebTest/WebAutomationEncapsulation/CaseFiles/deleteuser_demo.xlsx")
        st = wb["删除用户失败"]
        data = [[st.cell(row=i, column=j).value for j in range(1,5)] for i in range(2, st.max_row + 1)]
        return data